package com.truckdispatching;

import com.truckdispatching.util.SharedPreferencesUtil;

public class UserManager {
	private static boolean mIslogin = false;
	private static String mToken = "";
	private static String mName = "";
	private static String mMobile = "";
	private static String mPassword = "";
	private static String mMobile2 = "";
	private static String mIdCard = "";
	private static String mTruckNumber = "";
	private static String mTruckType = "";

	private static String mTruckLength = "";
	private static String mTarget1 = "";
	private static String mTarget2 = "";
	private static String mTarget3 = "";
	private static boolean mTruckStatus = false;
	private static String mAgent = "";

	private static String mPicIDCard = "";
	private static String mPicDrivingLicence = ""; // 驾驶证照片
	private static String mPicTravelLicence = ""; // 行驶照照片
	private static String mPicTruckHead = "";
	private static String mPicTruckBack = "";
	private static String mPicTruckSideFace = "";

	private static SharedPreferencesUtil mShared;
	static {
		mShared = SharedPreferencesUtil.getInstance();
	}

	public static void setIsLogin(boolean isLogin) {
		if (mIslogin != isLogin) {
			mIslogin = isLogin;
			mShared.putBoolean("isLogin", isLogin);
		}
	}

	public static boolean getIsLogin() {
		mIslogin = mShared.getBoolean("isLogin", false);
		return mIslogin;
	}

	public static String getToken() {
		mToken = mShared.getString("token", "");
		return mToken;
	}

	public static void setToken(String token) {
		if (!mToken.equals(token)) {
			mToken = token;
			mShared.putString("token", token);
		}
	}

	public static String getName() {
		mName = mShared.getString("name", "");
		return mName;
	}

	public static void setName(String name) {
		if (!mName.equals(name)) {
			mName = name;
			mShared.putString("name", name);
		}
	}

	public static String getMobile() {
		mMobile = mShared.getString("mobile", "");
		return mMobile;
	}

	public static void setMobile(String mobile) {
		if (!mMobile.equals(mobile)) {
			mMobile = mobile;
			mShared.putString("mobile", mobile);
		}
	}

	public static String getPassword() {
		mPassword = mShared.getString("password", "");
		return mPassword;
	}

	public static void setPassword(String password) {
		if (!mPassword.equals(password)) {
			mPassword = password;
			mShared.putString("password", password);
		}
	}

	public static String getMobile2() {
		mMobile2 = mShared.getString("mobile2", "");
		return mMobile2;
	}

	public static void setMobile2(String mobile2) {
		if (!mMobile2.equals(mobile2)) {
			mMobile2 = mobile2;
			mShared.putString("mobile2", mobile2);
		}
	}

	public static String getIdCard() {
		mIdCard = mShared.getString("idCard", "");
		return mIdCard;
	}

	public static void setIdCard(String idCard) {
		if (!mIdCard.equals(idCard)) {
			mIdCard = idCard;
			mShared.putString("idCard", idCard);
		}
	}

	public static String getTruckNumber() {
		mTruckNumber = mShared.getString("truckNumber", "");
		return mTruckNumber;
	}

	public static void setTruckNumber(String truckNumber) {
		if (!mTruckNumber.equals(truckNumber)) {
			mTruckNumber = truckNumber;
			mShared.putString("truckNumber", truckNumber);
		}
	}

	public static String getTruckType() {
		mTruckType = mShared.getString("truckType", "");
		return mTruckType;
	}

	public static void setTruckType(String truckType) {
		if (!mTruckType.equals(truckType)) {
			mTruckType = truckType;
			mShared.putString("truckType", truckType);
		}
	}

	public static String getTruckLength() {
		mTruckLength = mShared.getString("truckLength", "");
		return mTruckLength;
	}

	public static void setTruckLength(String truckLength) {
		if (!mTruckLength.equals(truckLength)) {
			mTruckLength = truckLength;
			mShared.putString("truckLength", truckLength);
		}
	}

	public static String getTarget1() {
		mTarget1 = mShared.getString("target1", "");
		return mTarget1;
	}

	public static void setTarget1(String target1) {
		if (!mTarget1.equals(target1)) {
			mTarget1 = target1;
			mShared.putString("target1", target1);
		}
	}

	public static String getTarget2() {
		mTarget2 = mShared.getString("target2", "");
		return mTarget2;
	}

	public static void setTarget2(String target2) {
		if (!mTarget2.equals(target2)) {
			mTarget2 = target2;
			mShared.putString("target2", target2);
		}
	}

	public static String getTarget3() {
		mTarget3 = mShared.getString("target3", "");
		return mTarget3;
	}

	public static void setTarget3(String target3) {
		if (!mTarget3.equals(target3)) {
			mTarget3 = target3;
			mShared.putString("target3", target3);
		}
	}

	public static boolean isTruckStatus() {
		mTruckStatus = mShared.getBoolean("truckStatus", false);
		return mTruckStatus;
	}

	public static void setTruckStatus(boolean truckStatus) {
		if (mTruckStatus != truckStatus) {
			mTruckStatus = truckStatus;
			mShared.putBoolean("truckStatus", truckStatus);
		}
	}

	public static String getAgent() {
		mAgent = mShared.getString("agent", "");
		return mAgent;
	}

	public static void setAgent(String agent) {
		if (!mAgent.equals(agent)) {
			mAgent = agent;
			mShared.putString("agent", agent);
		}
	}

	public static String getPicIDCard() {
		mPicIDCard = mShared.getString("picIDCard", "");
		return mPicIDCard;
	}

	public static void setPicIDCard(String picIDCard) {
		if (!mPicIDCard.equals(picIDCard)) {
			mPicIDCard = picIDCard;
			mShared.putString("picIDCard", picIDCard);
		}
	}

	public static String getPicDrivingLicence() {
		mPicDrivingLicence = mShared.getString("picDrivingLicence", "");
		return mPicDrivingLicence;
	}

	public static void setPicDrivingLicence(String picDrivingLicence) {
		if (!mPicDrivingLicence.equals(picDrivingLicence)) {
			mPicDrivingLicence = picDrivingLicence;
			mShared.putString("picDrivingLicence", picDrivingLicence);
		}
	}

	public static String getPicTravelLicence() {
		mPicTravelLicence = mShared.getString("picTravelLicence", "");
		return mPicTravelLicence;
	}

	public static void setPicTravelLicence(String picTravelLicence) {
		if (!mPicTravelLicence.equals(picTravelLicence)) {
			mPicTravelLicence = picTravelLicence;
			mShared.putString("picTravelLicence", picTravelLicence);
		}
	}

	public static String getPicTruckHead() {
		mPicTruckHead = mShared.getString("picTruckHead", "");
		return mPicTruckHead;
	}

	public static void setPicTruckHead(String picTruckHead) {
		if (!mPicTruckHead.equals(picTruckHead)) {
			mPicTruckHead = picTruckHead;
			mShared.putString("picTruckHead", picTruckHead);
		}
	}

	public static String getPicTruckBack() {
		mPicTruckBack = mShared.getString("picTruckBack", "");
		return mPicTruckBack;
	}

	public static void setPicTruckBack(String picTruckBack) {
		if (!mPicTruckBack.equals(picTruckBack)) {
			mPicTruckBack = picTruckBack;
			mShared.putString("picTruckBack", picTruckBack);
		}
	}

	public static String getPicTruckSideFace() {
		mPicTruckSideFace = mShared.getString("picTruckSideFace", "");
		return mPicTruckSideFace;
	}

	public static void setPicTruckSideFace(String picTruckSideFace) {
		if (!mPicTruckSideFace.equals(picTruckSideFace)) {
			mPicTruckSideFace = picTruckSideFace;
			mShared.putString("picTruckSideFace", picTruckSideFace);
		}
	}

	public static void logout() {
		mShared.remove("isLogin");
		mShared.remove("token");
		mShared.remove("name");
		mShared.remove("mobile");
		mShared.remove("password");
		mShared.remove("mobile2");
		mShared.remove("idCard");
		mShared.remove("truckNumber");
		mShared.remove("truckType");
		mShared.remove("truckLength");
		mShared.remove("target1");
		mShared.remove("target2");
		mShared.remove("target3");
		mShared.remove("truckStatus");
		mShared.remove("agent");
		mShared.remove("picIDCard");
		mShared.remove("picDrivingLicence");
		mShared.remove("picTravelLicence");
		mShared.remove("picTruckHead");
		mShared.remove("picTruckBack");
		mShared.remove("picTruckSideFace");
		mIslogin = false;
		mToken = "";
		mName = "";
		mMobile = "";
		mPassword = "";
		mMobile2 = "";
		mIdCard = "";
		mTruckNumber = "";
		mTruckType = "";
		mTruckLength = "";
		mTarget1 = "";
		mTarget2 = "";
		mTarget3 = "";
		mTruckStatus = false;
		mAgent = "";
		mPicIDCard = "";
		mPicDrivingLicence = ""; // 驾驶证照片
		mPicTravelLicence = ""; // 行驶照照片
		mPicTruckHead = "";
		mPicTruckBack = "";
		mPicTruckSideFace = "";
	}
}
